#!/usr/bin/env python
# -*- coding: utf-8 -*-

# @Time     :2021/01/09
# @Author   :Changshu
# @File     :Exercise_657.py

# 657. 机器人能否返回原点


class Solution:
	'''法一：暴力检索'''

	def judgeCircle(self, moves: str) -> bool:
		X, Y = 0, 0
		for s in moves:
			if s == "R":
				X += 1
			if s == "L":
				X -= 1
			if s == "U":
				Y -= 1
			if s == "D":
				Y += 1
		if X==0 and Y==0:
			return True
		return False


if __name__ == '__main__':
	solution=Solution()
	moves="UD"
	print(solution.judgeCircle(moves))
